<?php
include 'connect.php';

$city_selected = $_POST['city_selected'];

if (! empty($city_selected)){

	$sql = "SELECT  suburb from addresses WHERE city = ?";
	$stmt = $conn->prepare($sql);
	$stmt->bind_param('s', $city_selected);
	$stmt->execute();
	$result = $stmt->get_result();
	$data = $result->fetch_all(MYSQLI_ASSOC);
	foreach($data as $row){
?>
<option value="">SELECT SUBURB</option>
<option value="<?php echo $row['suburb'];?>"><?php echo $row['suburb'];?></option>
<?php
	}
}
?>
